﻿#region Using Directives

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;

    using Csla;

    using MarketPulse.BusinessLogic.Core;

#endregion

namespace MarketPulse.BusinessLogic.Common
{
    /// <summary>
    /// This class represents an indiviual attempt that a user can make to pass an accreditation.
    /// This class has no data access factory and as such cannot be persisted outside of an accreditation object. 
    /// 
    /// Instances of this object belong to an accreditation object and their persistence and general management are handled by their owner (Accreditation object).
    /// </summary>
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.DataAccess.Factory.AccreditationFactory, MarketPulse.DataAccess.Factory", "CreateUserAccreditation", "")]
    public class UserAccreditation : MarketPulseBase<UserAccreditation>
    {
        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// only via the static factory methods provided.
            /// </summary>
            private UserAccreditation()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods

                /// <summary>
                /// Method that creates a new UserAccreditation via the DataPortal client proxy
                /// </summary>
                /// <returns>The newly created UserAccreditation object</returns>
                public static UserAccreditation New()
                {
                    return DataPortal.Create<UserAccreditation>();
                }

            #endregion

        #endregion

        #region Properties

            #region Association GUID Properties (Foreign Keys)

                /// <summary>The GUID of the associated Accreditation</summary>
                public static PropertyInfo<Nullable<Guid>> AccreditationGUIDProperty = RegisterProperty<Nullable<Guid>>(p => p.AccreditationGUID);
                /// <summary>The GUID of the associated Accreditation</summary>
                public Nullable<Guid> AccreditationGUID
                {
                    get { return GetProperty(AccreditationGUIDProperty); }
                    set { SetProperty(AccreditationGUIDProperty, value); }
                }

                /// <summary>The GUID of the associated User</summary>
                public static PropertyInfo<Nullable<Guid>> UserGUIDProperty = RegisterProperty<Nullable<Guid>>(p => p.UserGUID);
                /// <summary>The GUID of the associated User</summary>
                public Nullable<Guid> UserGUID
                {
                    get { return GetProperty(UserGUIDProperty); }
                    set { SetProperty(UserGUIDProperty, value); }
                }

            #endregion

            /// <summary>
            /// The Version ID of the Accreditation.  When used in conjunction with an AccreditationGUID, this
            /// uniquely identifies a given Accreditation revision.
            /// </summary>
            public static PropertyInfo<long> VersionIDProperty = RegisterProperty<long>(p => p.VersionID);
            /// <summary>
            /// The Version ID of the Accreditation.  When used in conjunction with an AccreditationGUID, this
            /// uniquely identifies a given Accreditation revision.
            /// </summary>
            public long VersionID
            {
                get { return GetProperty(VersionIDProperty); }
                set { SetProperty(VersionIDProperty, value); }
            }

            /// <summary>Whether or not the user is accredited for the Accreditation.</summary>
            public static PropertyInfo<bool> AccreditedProperty = RegisterProperty<bool>(p => p.Accredited);
            /// <summary>Whether or not the user is accredited for the Accreditation.</summary>
            public bool Accredited
            {
                get { return GetProperty(AccreditedProperty); }
                set { SetProperty(AccreditedProperty, value); }
            }    

        #endregion

    }
}
